﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace Domain.Infrastructure
{
    /// <summary>
    /// 领域基础 接口  数据仓库 泛型接口
    /// </summary>
    /// <typeparam name="T">实体类型</typeparam>
    public interface IRepositoryBase<T> where T : class, new()
    {
        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        bool Insert(T entity);
        /// <summary>
        /// 插入 list
        /// </summary>
        /// <param name="entitys"></param>
        /// <returns></returns>
        bool Insert(List<T> entitys);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        bool Update(T entity);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        bool Delete(T entity);
        /// <summary>
        /// /// <summary>
        /// 通过主键删除 实体
        /// </summary>
        /// <param name="key">主键</param>
        /// <returns></returns>
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        bool Delete(string key);
        /// <summary>
        /// 通过主键获取实体
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        T GetEntity(string key);
        /// <summary>
        /// 得到所有列表
        /// </summary>
        /// <returns></returns>
        List<T> GetList();
       
        /// <summary>
        /// 分页获取所有数据
        /// </summary>
        /// <param name="pagination"></param>
        /// <returns></returns>
        List<T> GetList(Pagination pagination);




        //List<T> GetList(string strSql);
        //List<T> GetList(string strSql, object[] dbParameter);
        ///// <summary>
        ///// 得到所有列表
        ///// </summary>
        ///// <returns></returns>
        //List<T> GetList(Expression<Func<T, bool>> predicate);
        ///// <summary>
        ///// 分页获取所有数据
        ///// </summary>
        ///// <param name="pagination"></param>
        ///// <param name="predicate"></param>
        ///// <returns></returns>
        //List<T> GetList(Pagination pagination, Expression<Func<T, bool>> predicate);
    }
}
